package com.sunshine.wrongquestionset.room.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sunshine.wrongquestionset.room.entity.AppConfigEntity
import com.sunshine.wrongquestionset.room.entity.QuestionInfoEntity

/**
 * @author sunshine
 * @date 2021/3/26
 * @see com.sunshine.wrongquestionset.room.entity.QuestionInfoEntity
 */
@Dao
interface QuestionInfoDao {
    @Query("INSERT INTO question_info(questionId, familiarity, time) VALUES(:questionId,:familiarity,:time)")
    fun insert(questionId: Int, familiarity: Float, time: Long)

    @Delete(entity = QuestionInfoEntity::class)
    fun delete(questionInfoEntity: QuestionInfoEntity)

    @Query("SELECT * FROM question_info WHERE questionId=:questionId")
    fun select(questionId: Int): LiveData<List<QuestionInfoEntity>?>

    @Query("SELECT * FROM question_info")
    fun selectAll(): LiveData<List<QuestionInfoEntity>?>
}